/*
 * FileName: ProjectDaoImpl.java
 *
 * Company: 
 * Copyright 2011-2012 (C) Ultrapower Software CO., LTD. All Rights Reserved.
 */
package com.jmeurope.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.jmeurope.dao.IbatisBaseDao;
import com.jmeurope.dao.ProjectDao;
import com.jmeurope.model.Project;

/**
 * <p>
 * Description: 
 * </p>
 *
 * @author wangwei  leo_java@163.com
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * Jan 2, 2012 10:30:31 PM          wangwei        1.0         To create
 * </p>
 *
 * @since 
 * @see     
 */
@Repository
public class ProjectDaoImpl extends IbatisBaseDao implements ProjectDao {

	@Override
	public void delete(Integer id) throws Exception {
		// TODO Auto-generated method stub
	}

	@Override
	public Project find(Integer id) throws Exception {
		return (Project)getSqlMapClientTemplate().getSqlMapClient().queryForObject("selectProjectsById", id);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Project> findAll() throws Exception {
		return getSqlMapClientTemplate().getSqlMapClient().queryForList("getAllProjects");
	}

	@Override
	public Integer insert(Project entity) throws Exception {
		// TODO Auto-generated method stub
		return (Integer)getSqlMapClientTemplate().getSqlMapClient().insert("insertProject", entity);
	}
	@Override
	public void update(Project entity) throws Exception {
		getSqlMapClientTemplate().getSqlMapClient().update("updateProjects", entity);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Project> getProjectsByStattusAndBussinessId(Map map)
			throws Exception {
		return getSqlMapClientTemplate().getSqlMapClient().queryForList("getAllProjectsByStatusAndBussinessId", map);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Project> getProjectsByStattusAndUpdateDate(Map map)
			throws Exception {
		return getSqlMapClientTemplate().getSqlMapClient().queryForList("getProjectsByDateAndStatus", map);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Project> getProjectsByStatus(Map map) throws Exception {
		// TODO Auto-generated method stub
		return getSqlMapClientTemplate().getSqlMapClient().queryForList("getAllProjectsByStatus",map);
	}

}
